import Vue from 'vue'
import Router from 'vue-router'

/* 主页 */
// import Home from '@/page/Home'
import BuyPay from '@/page/active/BuyPay'
import ChosePay from '@/page/active/ChosePay'
import UseDetial from '@/page/active/UseDetial'
import OrderList from '@/page/active/OrderList'
import Success from '@/page/active/Success'
import hkSuccess from '@/page/active/hkSuccess'
import PostPay from '@/page/active/PostPay'
import HkVaccine from '@/page/active/HkVaccine'
import OrderDetial from '@/page/active/OrderDetial'

// 后台
import List from '@/page/admin/List'
import Login from '@/page/admin/Login'
Vue.use(Router)

// 判断是否登录
// let isLogin = function () {
//   if (!localStorage.pwd) {
//     this.$router.replace({name: 'Login'})
//   }
// }

export default new Router({
  mode: 'history',
  base: '/offlinepay-web',
  routes: [
    {
      path: '/',
      name: 'ChosePay',
      component: ChosePay,
      meta: {title: '线下支付'}
    },
    {
      path: '/active/BuyPay/:id',
      name: 'BuyPay',
      component: BuyPay,
      meta: {title: '买单'}
    },
    // {
    //   path: '/active/ChosePay',
    //   name: 'ChosePay',
    //   component: ChosePay,
    //   meta: {title: '线下支付'}
    // },
    {
      path: '/active/UseDetial',
      name: 'UseDetial',
      component: UseDetial,
      meta: {title: '说明'}
    },
    {
      path: '/active/Success',
      name: 'Success',
      component: Success,
      meta: {title: '支付成功'}
    },
    {
      path: '/active/hksuccess/:id',
      name: 'hkSuccess',
      component: hkSuccess,
      meta: {title: '支付成功'}
    },
    {
      path: '/active/OrderList',
      name: 'OrderList',
      component: OrderList,
      meta: {title: '买单记录'}
    },
    {
      path: '/active/PostPay',
      name: 'PostPay',
      component: PostPay,
      meta: {title: '支付凭证'}
    },
    // // 后台
    // {
    //   path: '/admin',
    //   name: 'Admin',
    //   component: Admin,
    //   children: [
    //     {
    //       path: 'list',
    //       name: 'List',
    //       component: List,
    //       meta: {title: '收款记录'},
    //       beforeEnter: (to, from, next) => {
    //         console.log(33)
    //       }
    //     }
    //   ]
    //   // meta: {title: '收款记录'}
    // }
    {
      path: '/admin/list',
      name: 'List',
      component: List,
      meta: {title: '收款记录'}
    },
    {
      path: '/admin/login',
      name: 'Login',
      component: Login,
      meta: {title: '登陆'}
    },
    {
      path: '/active/hkvaccine/:id',
      name: 'HkVaccine',
      component: HkVaccine,
      meta: {title: '香港疫苗套餐'}
    },
    {
      path: '/active/orderdetial/:id',
      name: 'OrderDetial',
      component: OrderDetial,
      meta: {title: '订单详情'}
    }
  ]
})
